<?php
namespace app\first\model;

use app\admin\model\Pic;
use think\Model;
/**
 * Class Push
 * @package app\push\validate
 */
class App extends Model{
    protected $autoWriteTimestamp = false;

    /**
     * @return array|\PDOStatement|string|Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getLastOne(){
        $info = $this->field('update',true)->order('create_time desc')->find();
        return $info?$info:[];
    }

    /**
     * @param $value
     * @return array|bool|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFounÍdException
     * @throws \think\exception\DbException
     */
    public function getImageAttr($value){
        if(empty($value)){
            return '';
        }
        $pic = new Pic();
        return $pic->getUrlsById(explode(',',$value));
    }
}